<template>
    <div class="photoinfo-container">
        <h3>{{info.title}}</h3>
        <p class="subtitle">
            <span>发表时间:{{info.createDate|dataFormat("YYYY年MM月DD日 HH:mm:ss")}}</span>
            <span>点击:0次</span>
        </p>
        <hr>
        <!-- 缩略图区域 -->
        <div class="thums">
            <template>
                <vue-preview :slides="slide1" @close="handleClose"></vue-preview>
            </template>
        </div>
        <div class="container" v-html="info.content">

        </div>
        <!-- 评论子组件 -->
        <comment :nid="id"></comment>
    </div>
</template>
<style lang="scss" scoped>
.photoinfo-container{
    padding: 3px;
    h3{
        color: #26A2FF;
    font-size:15px;
    text-align: center; 
    margin: 15px 0;
    }
    .subtitle{
        display: flex;
        justify-content: space-between;
    }
    .container{
        font-size: 13px;
        line-height: 30px;
    }
}
</style>
<script>
import comment from "../subcomponents/comment.vue"
export default {
    data(){
        return {
            id:this.$route.params.id,
            info:{},
            slide1: [
                        {
                        src: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg',
                        msrc: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg',
                        alt: 'picture1',
                        title: 'Image Caption 1',
                        w: 600,
                        h: 400
                        },
                        {
                        src: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_b.jpg',
                        msrc: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_m.jpg',
                        alt: 'picture2',
                        title: 'Image Caption 2',
                        w: 1200,
                        h: 900
                        }
                    ]
        }
    },
    created(){
        this.getPhotoInfo();
    },
    methods:{
        getPhotoInfo(){
            this.$http.get("getEssayInfoById?id="+this.id).then(res=>{
                this.info=res.body.data
            })
        },
        handleClose () {
        console.log('close event')
      }
    },
    components:{
        comment
    }
}
</script>